package September10.CompanyTest;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Company company = new Company("Moonshot AI", "123 Moonshot Street", "123-456-7890", "AI开发");

        while (true) {
            System.out.println("\n选项：");
            System.out.println("1. 招聘员工");
            System.out.println("2. 解雇员工");
            System.out.println("3. 打印员工信息");
            System.out.println("4. 统计员工人数");
            System.out.println("5. 获取薪水最高的员工");
            System.out.println("6. 退出");

            String option = scanner.nextLine();

            switch (option) {
                case "1":
                    System.out.println("输入员工姓名：");
                    String name = scanner.nextLine();
                    System.out.println("输入年龄：");
                    int age = scanner.nextInt();
                    scanner.nextLine(); // 消耗换行符
                    System.out.println("输入性别：");
                    String gender = scanner.nextLine();
                    System.out.println("输入职位：");
                    String position = scanner.nextLine();
                    System.out.println("输入薪水：");
                    double salary = scanner.nextDouble();
                    scanner.nextLine(); // 消耗换行符
                    System.out.println("输入工号：");
                    String id = scanner.nextLine();
                    company.hireEmployee(new Employee(name, age, gender, position, salary, id));
                    break;
                case "2":
                    System.out.println("输入要解雇的员工工号：");
                    String fireId = scanner.nextLine();
                    company.fireEmployee(fireId);
                    break;
                case "3":
                    company.printEmployeeInfo();
                    break;
                case "4":
                    company.countEmployees();
                    break;
                case "5":
                    Employee highestPaid = company.getHighestPaidEmployee();
                    if (highestPaid != null) {
                        System.out.println("薪水最高的员工：" + highestPaid);
                    } else {
                        System.out.println("未找到员工。");
                    }
                    break;
                case "6":
                    System.out.println("退出程序。");
                    scanner.close();
                    return;
                default:
                    System.out.println("无效选项，请重新输入。");
                    break;
            }
        }
    }
}

